home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1990 / Oct 90 / MacApp.Tech$ 10⁄26⁄90 / 2226-Re Printing Headers-Oct90 < prev    next >
Encoding:
Text File  |  1991-03-06  |  4.1 KB  |  109 lines  |  [TEXT/GEOL]

  1. Item    3166314                         23-Oct-90        12:43PDT
  2.  
  3. From:   PHAROS.TECH                     Pharos Tech, Tech Staff,PRT
  4.  
  5. To:     MACAPP.TECH$                    MacApp Technical
  6.  
  7. Sub:    RE: Printing Headers
  8.  
  9. From: Schmitz, Scott D. on Tue, Oct 23, 1990 3:43 PM
  10. Subject: RE: Printing Headers
  11. To: MacApp
  12.  
  13. This message was posted a while back.  Perhaps it can help.
  14. _______________________________________________________________________________
  15. From: FARALLON.ENG on Wed, Aug 29, 1990 8:38 PM
  16. Subject: Re: Complex Printing
  17.  
  18. Item    0092384                         29-Aug-90        16:04PDT
  19.  
  20. From:   FARALLON.ENG                    Farallon, Engineering,PRT
  21.  
  22. To:     D4695                           Lucas Arts Editing Systems,PRT
  23.         MACAPP.TECH$                    MacApp Technical
  24.  
  25. Sub:    Re: Complex Printing
  26.  
  27. Peter,
  28.  
  29. I had a very similar need for printing a window with multiple scrollers in my
  30. application (a regular list view and a palette view that scroll together via
  31. USynchScroller). Like you, I also looked to the Calc example for help, only to
  32. find out that it solves the problem by not printing its palette views
  33. (row/column headers) at all!
  34.  
  35. What I came up with is to print my palette view in the header section during
  36. calls to AdornPage. Before calls to TYourView.Draw the page interior is focused
  37. on, but before calls to AdornPage the exterior (margins) are focused on. Here's
  38. what I did (it's kind of a hack, but it works):
  39.  
  40. 1) Create a descendant of TStdPrintHandler (TListPrintHandler) and override its
  41. AdornPage method.
  42.  
  43. 2) In your TMainView.IMainView (my TListView.IListView) method create and
  44. assign this new print handler to the main view:
  45.  
  46.     {Now create a handler for me that will also print my Palette header view}
  47.     New(aListPrintHandler);
  48.     FailNil(aListPrintHandler);
  49.     aListPrintHandler.IStdPrintHandler(itsDocument, SELF, FALSE, TRUE, TRUE);
  50.  
  51. 3) Because I use minimal margins on my printouts (except for the top, where my
  52. palette view gets printed), I use the following (immediately following above
  53. lines) to create header space:
  54.  
  55.     aListPrintHandler.InstallMargins(aRect, TRUE);  {Install minimal margins}
  56.                                                     {aRect ignored here}
  57.     DoPagination;                                   {Force recalc of page area}
  58.      aRect := aListPrintHandler.fPageAreas.theMargins; {Get min. margin values}
  59.      aRect.top := 52;                {add small margin on top}
  60.     aListPrintHandler.InstallMargins(aRect, FALSE); {Install modified margins}
  61.     DoPagination;                                   {Force recalc of page area}
  62.  
  63. If you don't normally alter the default margins anyway, you wouldn't have to do
  64. this, because there would already be header space for your palette view to fit
  65. in.
  66.  
  67. 4) Here's my override of the AdornPage method, where the work gets done:
  68.    Note: fView is the view being printed (in my case, TListView); fViewedRect
  69.    is the rect of fView that is being printed at this moment; fListPalView is
  70.    my USynched palette view that I want printed across the top of the page.
  71.  
  72. {$S APrint}
  73. Procedure TListPrintHandler.AdornPage; OVERRIDE;
  74.  
  75.    var
  76.    itsTop: integer;
  77.    thePalRect: rect;
  78.  
  79.    begin
  80.    {Create the rect to send to my palette view's draw method}
  81.    itsTop := fPageAreas.theInk.top;
  82.    with thePalRect do
  83.    begin
  84.    left := fViewedRect.left;
  85.    top := itsTop;
  86.    right := fViewedRect.right;
  87.    bottom := itsTop + gOurDocument.fListPalView.fSize.v;
  88.    end;
  89.    if gOurDocument.fListPalView.Focus then
  90.    begin
  91.    SetOrigin(thePalRect.left, thePalRect.top); {so multi-page printing works}
  92.    SetRect(thePalRect, 0, 0, 32000, 32000);
  93.    ClipRect(thePalRect);                       {open up clipping}
  94.    gOurDocument.fListPalView.Draw(thePalRect); {draw our palette view!}
  95.    end;
  96.    if fView.Focus then;                          {restore proper focus}
  97.    end;
  98.  
  99. This works like a charm. Note that this works for my view, which has a single
  100. synced header view and not a side view like Calc has. But, with slight
  101. modification this would also work for Calc's side palettes.
  102.  
  103. Hope this helps...
  104.  
  105. Eric Knight
  106. Farallon Computing
  107.  
  108.  
  109.